<script setup>
import { onMounted } from 'vue'
import { ref } from 'vue'
import * as echarts from 'echarts'

const charts = ref()

onMounted(() => {
  let myCharts = echarts.init(charts.value)

  myCharts.setOption({
    xAxis: {
      min: 0,
      max: 100,
      show: false
    },
    yAxis: {
      type: 'category',
      show:false
    },
    series: [
      {
        type: 'bar',
        data: [60],
        barWidth: 20,
        itemStyle: {
          borderRadius: 10,
          color: '#007afe'
        },
        z: 3
      },
      {
        type: 'bar',
        data: [100],
        barWidth: 20,
        itemStyle: {
          borderRadius: 10,
          color: '#ff4b7a'
        },
        barGap: '-100%'
      }
    ],
    grid: {
      left: 50,
      top: 0,
      right: 50,
      bottom: 0
    }
  })
})
</script>

<template>
  <div class="box1">
    <div class="title">
      <p>男女比例</p>
      <img src="../../images/dataScreen-title.png" alt="">
    </div>
    <div class="sex">
      <div class="man">
        <p>男士</p>
        <img src="../../images/man.png" alt="">
      </div>
      <div class="woman">
        <p>女士</p>
        <img src="../../images/woman.png" alt="">
      </div>
    </div>
    <div class="data">
      <p>男士60%</p>
      <p>女士40%</p>
    </div>
    <div class="charts" ref="charts">

    </div>
  </div>
</template>

<style scoped lang="less">
.box1 {
  width: 100%;
  height: 100%;
  background: url(../../images/dataScreen-main-lb.png) no-repeat;
  background-size: 100% 100%;
  .title {
    p {
      color: white;
      font-size: 16px;
      margin-bottom: 8px;
    }
  }
  .sex {
    display: flex;
    justify-content: space-around;
    margin-top: 50px;
    .man {
      width: 111px;
      height: 116px;
      display: flex;
      flex-direction: column;
      align-items: center;
      background: url(../../images/man-bg.png) no-repeat;
      img {
        margin-top: 15px;
      }
    }
    .woman {
      width: 111px;
      height: 116px;
      display: flex;
      flex-direction: column;
      align-items: center;
      background: url(../../images/woman-bg.png) no-repeat;
      img {
        margin-top: 15px;
      }
    }
  }
  .data {
    display: flex;
    justify-content: space-around;
  }
  .charts {
    height: 40px;
    width: 100%;
  }
}
</style>
